package com.asiainfo.kbisheet.components.condition.hidden
{
	import com.asiainfo.kbisheet.common.Util;
	import com.asiainfo.kbisheet.components.condition.ConditionInput;
	import com.asiainfo.kbisheet.components.condition.ConditionItem;
	import com.asiainfo.kbisheet.model.SettingModel;
	
	import spark.components.TextInput;
	
	/**
	 * 隐藏(hidden)输入条件的单组件呈现
	 */
	public class ConditionInputHidden extends ConditionInput
	{
		private var tiHidden:TextInput;
		public function ConditionInputHidden(parent:ConditionItem)
		{
			super(parent);
		}
		
		override public function get value():String{		
			if(Util.isNull(_parent.preset)){
				if(Util.isNotNull(tiHidden.text))
					return tiHidden.text;
				else
					return null;
			}
			else{
				return _parent.preset;
			}				
		}
		
		override protected function createChildren():void {
			tiHidden = new TextInput();
			if(!SettingModel.getInstance().settingVO.debug){
				tiHidden.visible = false;
				tiHidden.width = 0;
				tiHidden.height = 0;
			}
			tiHidden.text = _parent.preset;
			addElement(tiHidden);
		}
	}
}